/**
 * 创建人:  @author huangpeng
 * 创建时间:  2024年10月13日 20:18
 * 项目名称:  lemon-blog-cloud
 * 文件名称:  BlBlogApprovalController
 * 文件描述:  @Description: 文章复核Controller
 * 公司名称:  xxxxxx
 * <p>
 * All rights Reserved, Designed By xxxxxx
 *
 * @Copyright: 2021-2024
 */
package com.lemon.blog.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import com.lemon.common.log.annotation.Log;
import com.lemon.common.log.enums.BusinessType;
import com.lemon.common.security.annotation.RequiresPermissions;
import com.lemon.blog.system.domain.BlBlogApproval;
import com.lemon.blog.system.service.IBlBlogApprovalService;
import com.lemon.common.core.web.controller.BaseController;
import com.lemon.common.core.web.domain.AjaxResult;
import com.lemon.common.core.utils.poi.ExcelUtil;
import com.lemon.common.core.web.page.TableDataInfo;

/**
 * 包名称：com.lemon.system.controller
 * 类名称：BlBlogApprovalController
 * 类描述：文章复核Controller
 * 创建人：@author lemon
 * 创建时间：2024-10-13
 */
@Api("文章复核")
@RestController
@RequestMapping("/blog/approve")
public class BlBlogApprovalController extends BaseController {

    @Autowired
    private IBlBlogApprovalService blBlogApprovalService;

    /**
     * 查询文章复核列表
     * @Title: list
     * @Description: 查询文章复核列表
     * @param blBlogApproval 文章复核
     * @return: TableDataInfo
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @GetMapping("/list")
    public TableDataInfo list(BlBlogApproval blBlogApproval) {
        startPage();
        List<BlBlogApproval> list = blBlogApprovalService.selectBlBlogApprovalList(blBlogApproval);
        return getDataTable(list);
    }

    /**
     * 导出文章复核列表
     * @Title: export
     * @Description: 导出文章复核列表
     * @param response 客户端响应对象
     * @param blBlogApproval 文章复核
     * @return:
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @Log(title = "文章复核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BlBlogApproval blBlogApproval) {
        List<BlBlogApproval> list = blBlogApprovalService.selectBlBlogApprovalList(blBlogApproval);
        ExcelUtil<BlBlogApproval> util = new ExcelUtil<BlBlogApproval>(BlBlogApproval.class);
        util.exportExcel(response, list, "文章复核数据");
    }

    /**
     * 获取文章复核详细信息
     * @Title: getInfo
     * @Description: 获取文章复核详细信息
     * @param id 文章复核主键
     * @return: AjaxResult
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(blBlogApprovalService.selectByPrimaryKey(id));
    }

    /**
     * 新增文章复核
     * @Title: add
     * @Description: 新增文章复核
     * @param blBlogApproval 文章复核
     * @return: AjaxResult
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @Log(title = "文章复核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BlBlogApproval blBlogApproval) {
        return toAjax(blBlogApprovalService.insert(blBlogApproval));
    }

    /**
     * 修改文章复核
     * @Title: edit
     * @Description: 修改文章复核
     * @param blBlogApproval 文章复核
     * @return: AjaxResult
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @Log(title = "文章复核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BlBlogApproval blBlogApproval) {
        return toAjax(blBlogApprovalService.update(blBlogApproval));
    }

    /**
     * 删除文章复核
     * @Title: remove
     * @Description: 删除文章复核
     * @param ids 需要删除的文章复核主键集合
     * @return: AjaxResult
     * @throws:
     * @author: lemon
     * @Date: 2024-10-13
     */
    @RequiresPermissions("blog:blog:approve")
    @Log(title = "文章复核", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(blBlogApprovalService.deleteByBatch(ids));
    }


}
